gridpack::network::BaseNetwork< _bus, _branch > Class Template Reference

#include <base_network.hpp>

Inheritance diagram for gridpack::network::BaseNetwork< _bus, _branch >:
Inheritance graph
[legend]
Collaboration diagram for gridpack::network::BaseNetwork< _bus, _branch >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef _bus BusType
typedef _branch BranchType
typedef boost::shared_ptr< _bus > BusPtr
typedef boost::shared_ptr
< _branch > 
BranchPtr

Public Member Functions

 BaseNetwork (const parallel::Communicator &comm)
virtual ~BaseNetwork (void)
void addBus (int idx)
void addBranch (int idx1, int idx2)
int numBuses (void)
int totalBuses (void)
int numBranches (void)
int totalBranches (void)
void setReferenceBus (int idx)
int getReferenceBus (void) const
bool setOriginalBusIndex (int idx, int o_idx)
bool setGlobalBusIndex (int idx, int g_idx)
bool setGlobalBranchIndex (int idx, int g_idx)
bool setOriginalBusIndex1 (int idx, int b_idx)
bool setOriginalBusIndex2 (int idx, int b_idx)
bool setGlobalBusIndex1 (int idx, int b_idx)
bool setGlobalBusIndex2 (int idx, int b_idx)
bool setLocalBusIndex1 (int idx, int b_idx)
bool setLocalBusIndex2 (int idx, int b_idx)
bool setActiveBus (int idx, bool flag)
bool setActiveBranch (int idx, bool flag)
bool clearBranchNeighbors (int idx)
bool addBranchNeighbor (int idx, int br_idx)
bool getActiveBus (int idx)
int getOriginalBusIndex (int idx)
int getGlobalBusIndex (int idx)
BusPtr getBus (int idx)
bool getActiveBranch (int idx)
int getGlobalBranchIndex (int idx)
BranchPtr getBranch (int idx)
void getOriginalBranchEndpoints (int idx, int *idx1, int *idx2)
boost::shared_ptr
< component::DataCollection
getBusData (int idx)
boost::shared_ptr
< component::DataCollection
getBranchData (int idx)
std::vector< int > getConnectedBranches (int idx) const
std::vector< int > getConnectedBuses (int idx) const
void getBranchEndpoints (int idx, int *bus1, int *bus2) const
void assemble (void)
 Assemble local part of network.
void partition (void)
void clean (void)
template<class _new_bus , class _new_branch >
void clone (boost::shared_ptr< gridpack::network::BaseNetwork< _new_bus, _new_branch > > &new_network)
void resetGlobalIndices (bool flag)
void clear (void)
void allocXCBus (int size)
void freeXCBus (void)
void allocXCBusPointers (int size)
void setXCBusBuffer (int idx, void *ptr)
void * getXCBusBuffer (int idx)
void allocXCBranch (int size)
void freeXCBranch (void)
void * getXCBranchBuffer (int idx)
void allocXCBranchPointers (int size)
void setXCBranchBuffer (int idx, void *ptr)
void initBusUpdate (void)
void updateBuses (void)
void initBranchUpdate (void)
void updateBranches (void)
void writeGraph (const std::string &outname)
void setMap (void)
std::vector< int > getLocalBusIndices (int idx)
std::vector< int > getLocalBranchIndices (int idx1, int idx2)
boost::shared_ptr
< gridpack::component::DataCollection
getNetworkData ()
void broadcastNetworkData (int idx)

Protected Member Functions

 BaseNetwork (const BaseNetwork &old)

Detailed Description

template<class _bus, class _branch>
class gridpack::network::BaseNetwork< _bus, _branch >

class BaseNetwork: This is the base class for creating distributed networks. It is basically a container that supports the network topology, allows user-defined buses and branches to be added to the network and has containers that can be used to store parameters for input or output. BaseNetwork also implements ghost bus and ghost branch update for the network. The BaseNetwork class also contains the partitioner, although this is implemented using several additional classes to encapsulate the partitioner from the remainder of the network class.


Member Typedef Documentation

template<class _bus , class _branch >
typedef boost::shared_ptr<_branch> gridpack::network::BaseNetwork< _bus, _branch >::BranchPtr
template<class _bus , class _branch >
typedef _branch gridpack::network::BaseNetwork< _bus, _branch >::BranchType
template<class _bus , class _branch >
typedef boost::shared_ptr<_bus> gridpack::network::BaseNetwork< _bus, _branch >::BusPtr
template<class _bus , class _branch >
typedef _bus gridpack::network::BaseNetwork< _bus, _branch >::BusType

Type declarations that can be used external to the BaseNetwork class


Constructor & Destructor Documentation

template<class _bus , class _branch >
gridpack::network::BaseNetwork< _bus, _branch >::BaseNetwork ( const parallel::Communicator comm  )  [explicit]

Default constructor.

template<class _bus , class _branch >
virtual gridpack::network::BaseNetwork< _bus, _branch >::~BaseNetwork ( void   )  [virtual]

Default destructor.

template<class _bus , class _branch >
gridpack::network::BaseNetwork< _bus, _branch >::BaseNetwork ( const BaseNetwork< _bus, _branch > &  old  )  [protected]

Protected copy constructor to avoid unwanted copies.


Member Function Documentation

template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::addBranch ( int  idx1,
int  idx2 
)

Add a branch locally to the network. A branch is defined by buses at either end

Parameters:
idx1 original bus index of bus 1
idx2 original bus index of bus 2
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::addBranchNeighbor ( int  idx,
int  br_idx 
)

Add local index for a branch attached to bus at idx

Parameters:
idx local index of bus
br_idx local index of branch attached to bus
Returns:
false if no bus exists for idx
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::addBus ( int  idx  ) 

Add a bus locally to the network

Parameters:
idx original index of bus
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::allocXCBranch ( int  size  ) 

Allocate buffers for exchanging data for ghost branches

Parameters:
size size (in bytes) of buffer
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::allocXCBranchPointers ( int  size  ) 

Allocate array of pointers to buffers for exchanging data for ghost branchs

Parameters:
size size of buffers that will be assigned to pointers
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::allocXCBus ( int  size  ) 

Allocate array of pointers to buffers for exchanging data for ghost buses

Parameters:
size size (in bytes) of buffer
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::allocXCBusPointers ( int  size  ) 

Allocate buffers for exchanging data for ghost buses

Parameters:
size size of buffers that will be assigned to pointers
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::assemble ( void   ) 

Assemble local part of network.

template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::broadcastNetworkData ( int  idx  ) 

Broadcast network data object from one processor to remaining processors on network communicator

Parameters:
rank of processor that acts as root for broadcast

References gridpack::parallel::Distributed::communicator().

template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::clean ( void   ) 

Clean all ghost buses and branches from the system. This can be used before repartitioning the network. This operation also removes all exchange buffers, so these need to be reallocated after calling this method

References gridpack::network::BaseNetwork< _bus, _branch >::freeXCBranch(), and gridpack::network::BaseNetwork< _bus, _branch >::freeXCBus().

template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::clear ( void   ) 

Remove all buses and branches from the system.

template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::clearBranchNeighbors ( int  idx  ) 

Clear the list of neighbors for the bus at idx

Parameters:
idx local index of bus
Returns:
false if no bus exists for idx
template<class _bus , class _branch >
template<class _new_bus , class _new_branch >
void gridpack::network::BaseNetwork< _bus, _branch >::clone ( boost::shared_ptr< gridpack::network::BaseNetwork< _new_bus, _new_branch > > &  new_network  ) 
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::freeXCBranch ( void   ) 

Free buffers for exchange of bus data

template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::freeXCBus ( void   ) 

Free buffers for exchange of bus data

template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::getActiveBranch ( int  idx  ) 

Get status of the branch (local or ghosted)

Parameters:
idx local index of branch
Returns:
true if branch is locally held, false if it is ghosted
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::getActiveBus ( int  idx  ) 

Get status of the bus (local or ghosted)

Parameters:
idx local index of bus
Returns:
true if bus is locally held, false if it is ghosted
template<class _bus , class _branch >
BranchPtr gridpack::network::BaseNetwork< _bus, _branch >::getBranch ( int  idx  ) 

Retrieve a pointer to an existing branch

Parameters:
idx local index of requested branch
Returns:
a pointer to the requested branch
template<class _bus , class _branch >
boost::shared_ptr<component::DataCollection> gridpack::network::BaseNetwork< _bus, _branch >::getBranchData ( int  idx  ) 

Retrieve a pointer to the DataCollection object associated with branch indexed by idx

Parameters:
idx local index of requested branch
Returns:
a pointer to the requested branch data
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::getBranchEndpoints ( int  idx,
int *  bus1,
int *  bus2 
) const

Return indices of buses at either end of branch

Parameters:
idx local branch index
bus1 local index of bus at one end of branch
bus2 local index of bus at other end of branch
template<class _bus , class _branch >
BusPtr gridpack::network::BaseNetwork< _bus, _branch >::getBus ( int  idx  ) 

Retrieve a pointer to an existing bus

Parameters:
idx local index of requested bus
Returns:
a pointer to the requested bus.
template<class _bus , class _branch >
boost::shared_ptr<component::DataCollection> gridpack::network::BaseNetwork< _bus, _branch >::getBusData ( int  idx  ) 

Retrieve a pointer to the DataCollection object associated with bus indexed by idx

Parameters:
idx local index of requested bus
Returns:
a pointer to the requested bus data
template<class _bus , class _branch >
std::vector<int> gridpack::network::BaseNetwork< _bus, _branch >::getConnectedBranches ( int  idx  )  const

Return list of branches connected to bus

Parameters:
idx local bus index
Returns:
vector of local branch indices
template<class _bus , class _branch >
std::vector<int> gridpack::network::BaseNetwork< _bus, _branch >::getConnectedBuses ( int  idx  )  const

Return list of buses connected to central bus via one branch

Parameters:
idx local bus index
Returns:
vector of local bus indices
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::getGlobalBranchIndex ( int  idx  ) 

Get global index of the branch

Parameters:
idx local index of branch
Returns:
global index of branch
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::getGlobalBusIndex ( int  idx  ) 

Get global index of the bus

Parameters:
idx local index of bus
Returns:
global index of bus
template<class _bus , class _branch >
std::vector<int> gridpack::network::BaseNetwork< _bus, _branch >::getLocalBranchIndices ( int  idx1,
int  idx2 
)

Find the local indices given the original bus pair indices of a branch.

Parameters:
idx1 original index of bus1
idx2 original index of bus2
Returns:
set of local indices of branch. If vector is empty, no branch found
template<class _bus , class _branch >
std::vector<int> gridpack::network::BaseNetwork< _bus, _branch >::getLocalBusIndices ( int  idx  ) 

Find the local indices given the original index of a bus. Ghost buses may show up more than once.

Parameters:
idx original index of bus
Returns:
set of local indices of bus. If vector is empty, no buses found
template<class _bus , class _branch >
boost::shared_ptr<gridpack::component::DataCollection> gridpack::network::BaseNetwork< _bus, _branch >::getNetworkData (  ) 

Return a boost pointer to the DataCollection object containing parameters that describe the network as a whole

Returns:
a pointer to network-level data collection object
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::getOriginalBranchEndpoints ( int  idx,
int *  idx1,
int *  idx2 
)

Get original indices of the two buses at each end of a branch

Parameters:
idx local index of branch
idx1 original index of "from" bus
idx1 original index of "to" bus
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::getOriginalBusIndex ( int  idx  ) 

Get original index of the bus

Parameters:
idx local index of bus
Returns:
original index of bus
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::getReferenceBus ( void   )  const

Return index of reference bus.

Returns:
local index of reference bus. If reference bus is not on this processor then return -1.
template<class _bus , class _branch >
void* gridpack::network::BaseNetwork< _bus, _branch >::getXCBranchBuffer ( int  idx  ) 

Return a pointer to exchange buffer for bus

Parameters:
idx local index of bus
Returns:
pointer to exchange buffer
template<class _bus , class _branch >
void* gridpack::network::BaseNetwork< _bus, _branch >::getXCBusBuffer ( int  idx  ) 

Return a pointer to exchange buffer for bus

Parameters:
idx local index of bus
Returns:
pointer to exchange buffer
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::initBranchUpdate ( void   ) 
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::initBusUpdate ( void   ) 
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::numBranches ( void   ) 

Number of local branches (both active and inactive) on processor

Returns:
number of branches
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::numBuses ( void   ) 

Number of local buses (both active and inactive) on processor

Returns:
number of buses
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::partition ( void   ) 
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::resetGlobalIndices ( bool  flag  ) 
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setActiveBranch ( int  idx,
bool  flag 
)

Set the active flag of the branch

Parameters:
idx local index of branch
flag flag for setting bus as active or inactive
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setActiveBus ( int  idx,
bool  flag 
)

Set the active flag of the bus

Parameters:
idx local index of bus
flag flag for setting bus as active or inactive
Returns:
false if no bus exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setGlobalBranchIndex ( int  idx,
int  g_idx 
)

Set the global index of the branch

Parameters:
idx local index of branch
g_idx global index to be assigned to branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setGlobalBusIndex ( int  idx,
int  g_idx 
)

Set the global index of the bus

Parameters:
idx local index of bus
g_idx global index to be assigned to bus
Returns:
false if no bus exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setGlobalBusIndex1 ( int  idx,
int  b_idx 
)

Set the global index of the bus at the "from" end of branch

Parameters:
idx local index of branch
b_idx global index of "from" bus for this branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setGlobalBusIndex2 ( int  idx,
int  b_idx 
)

Set the global index of the bus at the "to" end of branch

Parameters:
idx local index of branch
b_idx global index of "to" bus for this branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setLocalBusIndex1 ( int  idx,
int  b_idx 
)

Set the local index of the bus at the "from" end of branch

Parameters:
idx local index of branch
b_idx local index of "from" bus for this branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setLocalBusIndex2 ( int  idx,
int  b_idx 
)

Set the local index of the bus at the "to" end of branch

Parameters:
idx local index of branch
b_idx local index of "to" bus for this branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::setMap ( void   ) 
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setOriginalBusIndex ( int  idx,
int  o_idx 
)

Set the original index of the bus (from configuration file)

Parameters:
idx local index of bus
o_idx original index assigned to bus
Returns:
false if no bus exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setOriginalBusIndex1 ( int  idx,
int  b_idx 
)

Set the original index of the bus at the "from" end of branch

Parameters:
idx local index of branch
b_idx original index of "from" bus for this branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
bool gridpack::network::BaseNetwork< _bus, _branch >::setOriginalBusIndex2 ( int  idx,
int  b_idx 
)

Set the original index of the bus at the "to" end of branch

Parameters:
idx local index of branch
b_idx original index of "to" bus for this branch
Returns:
false if no branch exists for idx
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::setReferenceBus ( int  idx  ) 

Designate a bus as a reference bus.

Parameters:
idx local index of bus
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::setXCBranchBuffer ( int  idx,
void *  ptr 
)

Store location of externally allocated buffer within a network

Parameters:
idx local index of branch associated with buffer
ptr location of buffer
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::setXCBusBuffer ( int  idx,
void *  ptr 
)

Store location of externally allocated buffer within a network

Parameters:
idx local index of bus associated with buffer
ptr location of buffer
template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::totalBranches ( void   ) 

Return the total number of branches in the entire network

Returns:
total number of branches

References gridpack::parallel::Distributed::communicator().

template<class _bus , class _branch >
int gridpack::network::BaseNetwork< _bus, _branch >::totalBuses ( void   ) 

Return the total number of buses in the entire network

Returns:
total number of buses

References gridpack::parallel::Distributed::communicator().

template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::updateBranches ( void   ) 
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::updateBuses ( void   ) 
template<class _bus , class _branch >
void gridpack::network::BaseNetwork< _bus, _branch >::writeGraph ( const std::string &  outname  ) 

Print out network topology to a file using Matlab format

Parameters:
outname name of file containing network topology

References gridpack::parallel::Distributed::communicator(), gridpack::parallel::DistributedInterface::processor_rank(), and gridpack::parallel::DistributedInterface::processor_size().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 3 Feb 2020 for GridPACK by  doxygen 1.6.1